package org.abettor.pushbox.activity;

import org.abettor.pushbox.upload.UploadMap;
import org.abettor.pushbox.R;

import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class ContactUsActivity extends Activity {
	private EditText replyMsg, email;
	private Button buttonOk;
	private UploadMap upload;

	protected class ButtonOnTouchListener implements OnClickListener {
		@Override
		public void onClick(View v) {
			String replayMsg = null;
			Editable r = replyMsg.getEditableText();
			if(r != null){
				replayMsg = r.toString().trim();
			}
			String emailStr = null;
			Editable e = email.getEditableText();
			if(e != null){
				emailStr = e.toString();
			}
			upload.replyMsg(replayMsg, emailStr);			
		}
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.contact_us_activity);
		replyMsg = (EditText) this.findViewById(R.id.reply_msg);
		email = (EditText) this.findViewById(R.id.email);
		buttonOk = (Button) this.findViewById(R.id.button_ok);
		upload = new UploadMap(this);
		buttonOk.setOnClickListener(new ButtonOnTouchListener());
	}
}
